<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="../js/jquery-3.5.1.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			var stu = [{
					"name": "张三",
					"sex": "男",
					"age": "20"
				},
				{
					"name": "李四",
					"sex": "男",
					"age": "18"
				},
				{
					"name": "王五",
					"sex": "男",
					"age": "19"
				}
			];
			$(document).ready(function() {
				var s = "";
				for (var i = 0; i < stu.length; i++) {
					s = "<tr>"; //重新装载每一行
					for (var key in stu[i]) { //此时key=属性名               	
						s = s + "<td>" + stu[i][key] + "</td>";
					}
					s += "</tr>";
					$("#tab").append(s); //把遍历到的每一行 加入
				}
			});
		</script>
	</head>
	<body>
		<table border="1px" id="tab"><!-- 没有border就没有框线 -->
			<tr>
				<td>姓名</td>
				<td>性别</td>
				<td>年龄</td>
			</tr>
		</table>
	</body>
</html>
